package com.ruoyi.web.controller.ToolController;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.web.controller.common.UrlCommon;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

@Api(tags = "ai 相关")
@ResponseBody
@RestController
@RequestMapping("/tool/ai")
public class AiController extends BaseController {

    @GetMapping("/dreamexplain")
    @ApiOperation("ai 解释梦")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "text", value = "内容")
    })
    //地址:https://api.aa1.cn/doc/dreamexplain.html
    public R<String> dreamexplain(@RequestParam String text) {
        String s = HttpUtil.get(UrlCommon.DREAM_EXPLAIN + "?text=" + text);
        String mean = JSONObject.parseObject(s).get("mean").toString();
        return R.ok(mean);
    }

//    @GetMapping("/bing/ying/ai")
//    @ApiOperation("必应 AI")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "msg", value = "内容")
//    })
//    //地址:https://api.aa1.cn/doc/dreamexplain.html
//    public R<String> bingYingAi(@RequestParam String msg) {
//        String path = "?msg=" + msg+"&model=down&type=json";
//        String s = HttpUtil.get(UrlCommon.BING_YING_AI + path);
//        String mean = JSONObject.parseObject(s).get("mean").toString();
//        return R.ok(mean);
//    }



}
